import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {

    private static int casos;
    private static Scanner consola = new Scanner(System.in);
    private static StringTokenizer st;
    private static StringBuilder salida = new StringBuilder();
    private static String linea[];

    public static void main(String[] args) {

        //Cantidad de casos
        casos = consola.nextInt();
        consola.nextLine();
        //para los distintos casos
        for (int j = 0; j < casos; j++) {
            st = new StringTokenizer(consola.nextLine(), " ");
            linea = new String[st.countTokens()];
            salida.append("Case #").append(j + 1).append(":");
            for (int i = linea.length - 1; i >= 0; i--) {
                linea[i] = st.nextToken();
            }
            for (String word : linea) {
                salida.append(" ").append(word);
            }
            salida.append("\n");
        }
        System.out.print(salida);
    }
}
